<%@ include file="/en/jsp/static.jsp" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="Common" %>
<%
  String SORTBY = (String) request.getAttribute("SORTBY");
%>


<jsp:include page="/en/jsp/header.jsp" flush="true"/>

<script Language="JavaScript">
  function confirmDel(entry)
	{
	  return confirm("Are you sure to delete " + entry);
  }
</script>

<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
<tr><td>
	  &nbsp;<img src="<%=imageDir%>/itemball.jpg" width=14 height=15 border=0 align="absmiddle">
	  <b><%=boxName%> - Resource Management</b>
</td></tr>
</table>
<br>



<table width="100%" border=0 cellpadding=0 cellspacing=0>

<FORM action="<%=servletDir%>/BoxResourceAction" method="POST">
  <input align=left type="submit" name="SubmitEdit" value="Add a Resource">
  <input type="button" value="Categories" onclick="window.location='<%=jspDir%>/resource/BoxResourceCatAdmin.jsp'" >
  <jsp:useBean id="home" class="linuxbox.resource.logic.BoxResource"/>
  <jsp:useBean id="cat" class="linuxbox.resource.logic.BoxResourceCat"/>

  <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 bgColor=#dddddd>
    <TR>
      <TH bgColor=#b9daf5><a href="<%=jspDir%>/resource/BoxResource.jsp?SORTBY=name">Name</a></TH>
      <TH bgColor=#b9daf5><a href="<%=jspDir%>/resource/BoxResource.jsp?SORTBY=category">Category</a></TH>
      <TH bgColor=#b9daf5><a href="<%=jspDir%>/resource/BoxResource.jsp?SORTBY=location">Location</a></TH>
      <TH bgColor=#b9daf5>Reserve</TH>
      <TH bgColor=#b9daf5>Description</TH>
      <TH bgColor=#b9daf5>Allow People</TH>
      <TH bgColor=#b9daf5>Delete</TH>
   </TR>
<%
  java.util.Iterator it = home.getAllResources(SORTBY);
  if ( it != null && it.hasNext())
  {
%>
    <Common:Iteration name="entry" type="linuxbox.resource.logic.BoxResourceEntry" group="<%=it%>">
      <TR>
        <TD bgColor=#eeeeee><a href="<%=servletDir%>/BoxResourceAction?SubmitEdit=edit&ID=<%=entry.getID()%>"><%=entry.getName()%></a></TD>
        <TD bgColor=#eeeeee><%=cat.getCategoryString(entry.getCategory())%></TD>
        <TD bgColor=#eeeeee><%=entry.getLocation()%></TD>
        <TD align=center bgColor=#eeeeee><a href="<%=servletDir%>/BoxReservationAction?SubmitEdit=Edit&RESOURCEID=<%=entry.getID()%>">Reserve</a> </TD>
        <TD bgColor=#eeeeee><%=entry.getDescription()%></TD>
        <TD align=center bgColor=#eeeeee><%=entry.getAllowPeople()%></TD>
        <TD align = center bgColor=#eeeeee><a href="<%=servletDir%>/BoxResourceAction?SubmitDelete=del&ID=<%=entry.getID()%>" Onclick='return confirmDel("<%=entry.getName()%>")'>Delete</a></TD>
      </TR>
    </Common:Iteration>
<%
  }
%>
  </TABLE>
</table>
</FORM>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
